/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.peluq.model.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Diego_M
 */
@Entity
@Table(name = "tarjeta", catalog = "peludb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tarjeta.findAll", query = "SELECT t FROM Tarjeta t"),
    @NamedQuery(name = "Tarjeta.findByTarjFecha", query = "SELECT t FROM Tarjeta t WHERE t.tarjFecha = :tarjFecha"),
    @NamedQuery(name = "Tarjeta.findByTarjDescri", query = "SELECT t FROM Tarjeta t WHERE t.tarjDescri = :tarjDescri")})
public class Tarjeta implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "tarj_fecha", nullable = false)
    private Integer tarjFecha;
    @Size(max = 30)
    @Column(name = "tarj_descri", length = 30)
    private String tarjDescri;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tarjeta")
    private Collection<DetTarjetas> detTarjetasCollection;

    public Tarjeta() {
    }

    public Tarjeta(Integer tarjFecha) {
        this.tarjFecha = tarjFecha;
    }

    public Integer getTarjFecha() {
        return tarjFecha;
    }

    public void setTarjFecha(Integer tarjFecha) {
        this.tarjFecha = tarjFecha;
    }

    public String getTarjDescri() {
        return tarjDescri;
    }

    public void setTarjDescri(String tarjDescri) {
        this.tarjDescri = tarjDescri;
    }

    @XmlTransient
    public Collection<DetTarjetas> getDetTarjetasCollection() {
        return detTarjetasCollection;
    }

    public void setDetTarjetasCollection(Collection<DetTarjetas> detTarjetasCollection) {
        this.detTarjetasCollection = detTarjetasCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tarjFecha != null ? tarjFecha.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tarjeta)) {
            return false;
        }
        Tarjeta other = (Tarjeta) object;
        if ((this.tarjFecha == null && other.tarjFecha != null) || (this.tarjFecha != null && !this.tarjFecha.equals(other.tarjFecha))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.peluq.model.entity.Tarjeta[ tarjFecha=" + tarjFecha + " ]";
    }
    
}
